# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Roman Kyrylych <Roman.Kyrylych@gmail.com>
# Contributor: Roman Kyrylych <Roman.Kyrylych@gmail.com>

pkgname=iniparser
pkgver=4.0
pkgrel=2
pkgdesc="A free stand-alone ini file parsing library written in portable ANSI C"
arch=('i686' 'x86_64')
url="http://ndevilla.free.fr/iniparser/"
license=('MIT')
depends=('glibc')
makedepends=('chrpath')
source=($pkgname-$pkgver.tar.gz::https://github.com/ndevilla/iniparser/archive/v$pkgver.tar.gz
        0001-allocate-memory-for-string-termination.patch)
md5sums=('94c7278f8d22de1a31320219b27634b0'
         '1ca2f65886484ea151d5076e09782c28')

prepare() {
  cd $srcdir/$pkgname-$pkgver
  patch -Np1 -i ../0001-allocate-memory-for-string-termination.patch
}

build() {
  cd $srcdir/$pkgname-$pkgver
  make
}

package() {
  cd $srcdir/$pkgname-$pkgver
  install -Dm644 src/iniparser.h $pkgdir/usr/include/iniparser.h
  install -Dm644 src/dictionary.h $pkgdir/usr/include/dictionary.h
  install -Dm644 libiniparser.a $pkgdir/usr/lib/libiniparser.a
  install -Dm644 libiniparser.so.0 $pkgdir/usr/lib/libiniparser.so.0
  install -Dm644 LICENSE $pkgdir/usr/share/licenses/iniparser/LICENSE
  ln -sf libiniparser.so.0 $pkgdir/usr/lib/libiniparser.so
  chrpath -d $pkgdir/usr/lib/libiniparser.so
}
